Calendar All Tests
Current file: /home/estudydev/workspace/eStudy_svn/web/user/classes/class.user.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 15
0.00 %0.00%
0.00% 0 / 113
 
User
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 15
0.00 %0.00%
0.00% 0 / 113
 public function __construct($userID = 0)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 15
 public function deleteUser()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 34
 public function setConfigData()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 13
 public function setStyleData()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 5
 public function setHelpData()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 24
 public function getUserID()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function userExists()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function getActionScript()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function getUploadDir()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function getUserData($field)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
 public function setUserData($field, $value)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
 public function getConfigData($field)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
 public function getHelp($field)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
 public function getStyles($field)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
 public function setStyles($field, $value)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3


       1                 : <?php                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
       2                 : /*--------------------------------------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                                                    
       3                 : This file is part of eStudy.                                                                                                                                                                                                                                                                                                                                                                                                                                                     
       4                 : user/classes/class.user.inc.php                                                                                                                                                                                                                                                                                                                                                                                                                                                  
       5                 : - Modulgruppe:  Benutzerverwaltung                                                                                                                                                                                                                                                                                                                                                                                                                                               
       6                 : - Beschreibung: Die Klasse "User" und dafuer wichtigen Attribute und Methoden wie User loeschen usw.                                                                                                                                                                                                                                                                                                                                                                             
       7                 : - Version:      0.3, 15/01/08                                                                                                                                                                                                                                                                                                                                                                                                                                                    
       8                 : - Autor(en):    Mirko Pitz    <mirko.pitz@mni.fh-giessen.de>                                                                                                                                                                                                                                                                                                                                                                                                                     
       9                 : Markus Keim    <markus.keim@mni.fh-giessen.de>                                                                                                                                                                                                                                                                                                                                                                                                                                   
      10                 : Ali-Riza Ciftcioglu <Ali-Riza.Ciftcioglu@mni.fh-giessen.de>                                                                                                                                                                                                                                                                                                                                                                                                                      
      11                 : +---------------------------------------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                                                    
      12                 : This program is free software; you can redistribute it and/or                                                                                                                                                                                                                                                                                                                                                                                                                    
      13                 : modify it under the terms of the GNU General Public License                                                                                                                                                                                                                                                                                                                                                                                                                      
      14                 : as published by the Free Software Foundation; either version 2                                                                                                                                                                                                                                                                                                                                                                                                                   
      15                 : of the License, or any later version.                                                                                                                                                                                                                                                                                                                                                                                                                                            
      16                 : +---------------------------------------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                                                    
      17                 : This program is distributed in the hope that it will be useful,                                                                                                                                                                                                                                                                                                                                                                                                                  
      18                 : but WITHOUT ANY WARRANTY; without even the implied warranty of                                                                                                                                                                                                                                                                                                                                                                                                                   
      19                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                                                                                                                                                                                                                                                                                                                                                                                    
      20                 : GNU General Public License for more details.                                                                                                                                                                                                                                                                                                                                                                                                                                     
      21                 : You should have received a copy of the GNU General Public License                                                                                                                                                                                                                                                                                                                                                                                                                
      22                 : along with this program; if not, write to the Free Software                                                                                                                                                                                                                                                                                                                                                                                                                      
      23                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                                                                                                                                                                                                                                                                                                                                                                                                      
      24                 : +--------------------------------------------------------------------------*/                                                                                                                                                                                                                                                                                                                                                                                                    
      25                 : /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      26                 :  * Diese Klasse repraesentiert einen User mit allen hierfuer notwendigen Eigenschaften und Methoden.                                                                                                                                                                                                                                                                                                                                                                             
      27                 :  * @package eStudy.User                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      28                 :  * @author  Mirko Pitz    <mirko.pitz@mni.fh-giessen.de>                                                                                                                                                                                                                                                                                                                                                                                                                         
      29                 :  * @author  Markus Keim    <markus.keim@mni.fh-giessen.de>                                                                                                                                                                                                                                                                                                                                                                                                                       
      30                 :  * @author  Ali-Riza Ciftcioglu <Ali-Riza.Ciftcioglu@mni.fh-giessen.de>                                                                                                                                                                                                                                                                                                                                                                                                          
      31                 :  * @version 0.3, 15/01/08                                                                                                                                                                                                                                                                                                                                                                                                                                                        
      32                 :  */                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      33                 : /**zum Ausfuehren automatischer Funktionen*/                                                                                                                                                                                                                                                                                                                                                                                                                                     
      34                 : require_once (PATH_TO_ROOT."common/classes/class.automation.inc.php");                                                                                                                                                                                                                                                                                                                                                                                                           
      35                 : /**zum Ausfuehren der E-Mail-Validierung*/                                                                                                                                                                                                                                                                                                                                                                                                                                       
      36                 : require_once (PATH_TO_ROOT."common/classes/class.email.inc.php");                                                                                                                                                                                                                                                                                                                                                                                                                
      37                 : require_once (PATH_TO_ROOT."messaging/classes/class.messaging.inc.php");                                                                                                                                                                                                                                                                                                                                                                                                         
      38                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      39                 : /** Zum auslesen der benutzerinfos aus der Datenbank*/                                                                                                                                                                                                                                                                                                                                                                                                                           
      40                 : require_once (PATH_TO_ROOT."user/classes/dataretriever/class.userdataretriever.inc.php");                                                                                                                                                                                                                                                                                                                                                                                        
      41                 : class User {                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
      42                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      43                 :      * ID des aktuellen User-Objekts                                                                                                                                                                                                                                                                                                                                                                                                                                             
      44                 :      * -1 = neuer Benutzer                                                                                                                                                                                                                                                                                                                                                                                                                                                       
      45                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      46                 :      * @access private                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      47                 :      * @var    integer                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      48                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      49                 :     protected $userID;                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      50                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      51                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      52                 :      * alle Daten aus user zu $userID                                                                                                                                                                                                                                                                                                                                                                                                                                            
      53                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      54                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      55                 :      * @var    array                                                                                                                                                                                                                                                                                                                                                                                                                                                             
      56                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      57                 :     protected $userData;                                                                                                                                                                                                                                                                                                                                                                                                                                                         
      58                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      59                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      60                 :      * Existiert angeforderter Benutzer in der DB                                                                                                                                                                                                                                                                                                                                                                                                                                
      61                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      62                 :      * @access private                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      63                 :      * @var    bool                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      64                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      65                 :     protected $exists;                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      66                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      67                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      68                 :      * Skriptname fuer Formulare                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      69                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      70                 :      * @access private                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      71                 :      * @var    string                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      72                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      73                 :     protected $actionScript;                                                                                                                                                                                                                                                                                                                                                                                                                                                     
      74                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      75                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      76                 :      * Array mit Daten aus config.ini                                                                                                                                                                                                                                                                                                                                                                                                                                            
      77                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      78                 :      * @access protected                                                                                                                                                                                                                                                                                                                                                                                                                                                         
      79                 :      * @var    array                                                                                                                                                                                                                                                                                                                                                                                                                                                             
      80                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      81                 :     protected $configData;                                                                                                                                                                                                                                                                                                                                                                                                                                                       
      82                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      83                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      84                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      85                 :      * Verzeichnisname fuer Benutzerbild                                                                                                                                                                                                                                                                                                                                                                                                                                         
      86                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      87                 :      * @access protected                                                                                                                                                                                                                                                                                                                                                                                                                                                         
      88                 :      * @var    string                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      89                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      90                 :     protected $uploadDir;                                                                                                                                                                                                                                                                                                                                                                                                                                                        
      91                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      92                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      93                 :      * Array mit CSS-Style-Informationen                                                                                                                                                                                                                                                                                                                                                                                                                                         
      94                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      95                 :      * @access protected                                                                                                                                                                                                                                                                                                                                                                                                                                                         
      96                 :      * @var    string                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      97                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      98                 :     protected $styles;                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      99                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     100                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     101                 :      * Array mit HelpIDs                                                                                                                                                                                                                                                                                                                                                                                                                                                         
     102                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     103                 :      * @access protected                                                                                                                                                                                                                                                                                                                                                                                                                                                         
     104                 :      * @var    string                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     105                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     106                 :     protected $help;                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     107                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     108                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     109                 :      * Konstruktor. Initialisiert die wichtigsten Object-Variablen                                                                                                                                                                                                                                                                                                                                                                                                               
     110                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     111                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     112                 :      * @param  integer $userID - ID des Benutzers, der bearbeitet werden soll                                                                                                                                                                                                                                                                                                                                                                                                    
     113                 :      * @return bool                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     114                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     115                 :     public function __construct($userID = 0) {                                                                                                                                                                                                                                                                                                                                                                                                                                   
     116               0 :         global $settings;                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     117               0 :         if (is_numeric($userID)) {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     118               0 :             $this->userID = $userID;                                                                                                                                                                                                                                                                                                                                                                                                                                             
     119                 :            /* Initialisiere userData,                                                                                                                                                                                                                                                                                                                                                                                                                                            
     120                 :             * wenn Daten in DB vorliegen, existiert der Benutzer                                                                                                                                                                                                                                                                                                                                                                                                                 
     121                 :             */                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     122               0 :             if($this->userID){                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     123               0 :                 $retriever = new UserDataRetriever($this->userID);                                                                                                                                                                                                                                                                                                                                                                                                               
     124               0 :                 $this->userData = $retriever->retrieve();                                                                                                                                                                                                                                                                                                                                                                                                                        
     125               0 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     126               0 :         if($this->userData['loginname']!="") $this->exists=true;                                                                                                                                                                                                                                                                                                                                                                                                                 
     127                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     128                 :          //Hole Configdaten aus settings-Array                                                                                                                                                                                                                                                                                                                                                                                                                                   
     129               0 :           $this->setConfigData();                                                                                                                                                                                                                                                                                                                                                                                                                                                
     130                 :           //Verzeichnis zum Benutzerbild setzen                                                                                                                                                                                                                                                                                                                                                                                                                                  
     131               0 :           $this->uploadDir = PATH_TO_ROOT.$settings['upload_path']."user/".$this->userID."/";                                                                                                                                                                                                                                                                                                                                                                                    
     132                 :             //Dialoge vorbereiten                                                                                                                                                                                                                                                                                                                                                                                                                                                
     133               0 :             $this->actionScript = PATH_TO_ROOT.SCRIPT_NAME."?user=".$this->userID;                                                                                                                                                                                                                                                                                                                                                                                               
     134                 :             //Tabellenlayouts bereitstellen                                                                                                                                                                                                                                                                                                                                                                                                                                      
     135               0 :             $this->setStyleData();                                                                                                                                                                                                                                                                                                                                                                                                                                               
     136                 :             //HelpIDs setzten                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     137               0 :             $this->setHelpData();                                                                                                                                                                                                                                                                                                                                                                                                                                                
     138                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     139               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     140                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     141                 :             //$this->exists = false;                                                                                                                                                                                                                                                                                                                                                                                                                                             
     142                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     143               0 :         return true;                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     144                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     145                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     146                 :      * Loescht Benutzer aus Portal                                                                                                                                                                                                                                                                                                                                                                                                                                               
     147                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     148                 :      * Prueft zunaechst ob die Aktion erlaubt und danach ob loeschen moeglich ist.                                                                                                                                                                                                                                                                                                                                                                                               
     149                 :      * Vor dem Loeschen des eigentlichen Datensatzes in der Tabelle user wird                                                                                                                                                                                                                                                                                                                                                                                                    
     150                 :      * die Modulautomatisierung aufgerufen.                                                                                                                                                                                                                                                                                                                                                                                                                                      
     151                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     152                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     153                 :      * @return bool mixed bool true = Benutzer erfolgreich geloescht                                                                                                                                                                                                                                                                                                                                                                                                             
     154                 :      *                       string = Fehlermeldung                                                                                                                                                                                                                                                                                                                                                                                                                              
     155                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     156                 :     public function deleteUser() {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     157               0 :         global $db, $EZSQL_ERROR;                                                                                                                                                                                                                                                                                                                                                                                                                                                
     158                 :         //Admins duerfen alle Benutzer loeschen, alle anderen duerfen nur sich selbst loeschen                                                                                                                                                                                                                                                                                                                                                                                   
     159               0 :         if (!($_SESSION['usergroup'] == 1 || $_SESSION['userid'] == $this->userID)) {                                                                                                                                                                                                                                                                                                                                                                                            
     160               0 :             return "Sie haben nicht das Recht fremde Benutzer zu loeschen!";                                                                                                                                                                                                                                                                                                                                                                                                     
     161                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     162               0 :         if (!$this->exists) {                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     163               0 :             return "Der Benutzer existiert nicht!";                                                                                                                                                                                                                                                                                                                                                                                                                              
     164                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     165                 :         //ID 0 und 1 duerfen nicht geloescht werden                                                                                                                                                                                                                                                                                                                                                                                                                              
     166               0 :         if ($this->userID <= 1) {                                                                                                                                                                                                                                                                                                                                                                                                                                                
     167               0 :             return "Der Benutzer <strong>".$this->userData['nachname'].", ".$this->userData['vorname']."</strong> darf nicht geloescht werden!";                                                                                                                                                                                                                                                                                                                                 
     168                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     169                 :         // Wenn der Benutzer noch in mindestens einem Kurs Mitglied ist, in dem er die Policy akzeptiert hat                                                                                                                                                                                                                                                                                                                                                                     
     170                 :         // und der nach dem Akzeptieren nicht mehr verlassen werden darf, nicht loeschen.                                                                                                                                                                                                                                                                                                                                                                                        
     171               0 :         require_once(PATH_TO_ROOT."courses/classes/class.coursepolicy.inc.php");                                                                                                                                                                                                                                                                                                                                                                                                 
     172               0 :         if (count(CoursePolicy::getCoursesOfUserWithAcceptedPolicy($this->userID, false))) {                                                                                                                                                                                                                                                                                                                                                                                     
     173               0 :             if (isset($_SESSION['userid']) && $_SESSION['userid'] == $this->userID) {                                                                                                                                                                                                                                                                                                                                                                                            
     174               0 :                 $msg = "Sie sind noch in mindestens einem Kurs Mitglied, den Sie nach dem Akzeptieren der Kurs-Vereinbarung nicht mehr verlassen koennen.<br />Waehrend dieser Zeit ist es Ihnen auch nicht moeglich, sich vom Portal abzumelden.";                                                                                                                                                                                                                              
     175               0 :             } else {                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     176               0 :                 $msg = "Der Benutzer ist noch in mindestens einem Kurs Mitglied, der nach dem Akzeptieren der Kurs-Vereinbarung nicht mehr verlassen werden darf.";                                                                                                                                                                                                                                                                                                              
     177                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     178               0 :             return $msg;                                                                                                                                                                                                                                                                                                                                                                                                                                                         
     179                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     180                 :         // Admin per PN benachrichtigen, wenn sich ein Benutzer selbst loescht                                                                                                                                                                                                                                                                                                                                                                                                   
     181               0 :         if (isset($_SESSION['userid']) && $_SESSION['userid'] == $this->userID) {                                                                                                                                                                                                                                                                                                                                                                                                
     182               0 :             ob_start(); // Ausgabe des PN-Moduls verwerfen                                                                                                                                                                                                                                                                                                                                                                                                                       
     183               0 :             $msg = new Messaging($this->userID);                                                                                                                                                                                                                                                                                                                                                                                                                                 
     184               0 :             $rec = $db->get_var("SELECT CONCAT(Nachname, ', ', Vorname, ', 1') FROM user WHERE ID=1");                                                                                                                                                                                                                                                                                                                                                                           
     185               0 :             $msg->sendMessage($rec, "Benutzer $this->userID abgemeldet", "Der Benutzer-Account mit der ID $this->userID wurde geloescht.\n"."Er enthielt folgende Daten:\n\n[tt]".Data::toHTML(print_r($db->get_row("SELECT *, FROM_UNIXTIME(lastlogin1) AS lastlogin1, FROM_UNIXTIME(lastlogin2) AS lastlogin2, FROM_UNIXTIME(lastlogout) AS lastlogout, FROM_UNIXTIME(policy_read) AS policy_read FROM user WHERE ID='$this->userID'", ARRAY_A), true), false) ."[/tt]", true);
     186               0 :             ob_end_clean();                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     187               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     188                 :         //################################                                                                                                                                                                                                                                                                                                                                                                                                                                       
     189                 :         //Zugriff auf die Automatisierung#                                                                                                                                                                                                                                                                                                                                                                                                                                       
     190                 :         //################################                                                                                                                                                                                                                                                                                                                                                                                                                                       
     191                 :         //neues objekt erstellen und standart logfile benutzen                                                                                                                                                                                                                                                                                                                                                                                                                   
     192               0 :         $autoDelete = new Automation("");                                                                                                                                                                                                                                                                                                                                                                                                                                        
     193               0 :         $autoDelete->deleteUser($this->userID);                                                                                                                                                                                                                                                                                                                                                                                                                                  
     194               0 :         if ($autoDelete) {                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     195               0 :             $errorCount = count($EZSQL_ERROR);                                                                                                                                                                                                                                                                                                                                                                                                                                   
     196               0 :             $db->query("DELETE FROM user WHERE ID='".$this->userID."' LIMIT 1");                                                                                                                                                                                                                                                                                                                                                                                                 
     197               0 :             if (count($EZSQL_ERROR) > $errorCount) {                                                                                                                                                                                                                                                                                                                                                                                                                             
     198               0 :                 return "Fataler Fehler beim L&ouml;schen der Benutzerdaten aufgetreten!";                                                                                                                                                                                                                                                                                                                                                                                        
     199                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     200               0 :             if ($db->rows_affected == 0) {                                                                                                                                                                                                                                                                                                                                                                                                                                       
     201               0 :                 return "Ung&uuml;ltige User-ID";                                                                                                                                                                                                                                                                                                                                                                                                                                 
     202               0 :             } elseif ($db->rows_affected > 1) {                                                                                                                                                                                                                                                                                                                                                                                                                                  
     203               0 :                 return $db->rows_affected."Fataler Fehler beim L&ouml;schen des Benutzers aufgetreten!";                                                                                                                                                                                                                                                                                                                                                                         
     204                 :             } else {                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     205               0 :                 return true;                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     206                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     207                 :         } else {                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     208               0 :             return "Benutzer konnte nicht geloescht werden";                                                                                                                                                                                                                                                                                                                                                                                                                     
     209                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     210                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     211                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     212                 :      * Holt alle relevanten Config-Daten aus der common/config.ini                                                                                                                                                                                                                                                                                                                                                                                                               
     213                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     214                 :      * Relevante Bereich sind :                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     215                 :      * - registerInfo                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     216                 :      * - userPicture                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     217                 :      * - userSettings                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     218                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     219                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     220                 :      * @return void                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     221                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     222                 :     public function setConfigData() {                                                                                                                                                                                                                                                                                                                                                                                                                                            
     223               0 :         global $settings;                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     224               0 :         if (is_numeric($settings['register_min_pass_length'])) {                                                                                                                                                                                                                                                                                                                                                                                                                 
     225               0 :             $this->configData['minPassLength'] = $settings['register_min_pass_length'];                                                                                                                                                                                                                                                                                                                                                                                          
     226               0 :         } else {                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     227               0 :             $this->configData['minPassLength'] = 1;                                                                                                                                                                                                                                                                                                                                                                                                                              
     228                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     229               0 :         if (is_numeric($settings['register_min_login_length'])) {                                                                                                                                                                                                                                                                                                                                                                                                                
     230               0 :             $this->configData['minLoginLength'] = $settings['register_min_login_length'];                                                                                                                                                                                                                                                                                                                                                                                        
     231               0 :         } else {                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     232               0 :             $this->configData['minLoginLength'] = 1;                                                                                                                                                                                                                                                                                                                                                                                                                             
     233                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     234               0 :         if (is_numeric($settings['userpic_max_filesize'])) $this->configData['maxFileSize'] = $settings['userpic_max_filesize'];                                                                                                                                                                                                                                                                                                                                                 
     235               0 :         if ($settings['userpic_allowed_filetypes']) $this->configData['allowedFileTypes'] = $settings['userpic_allowed_filetypes'];                                                                                                                                                                                                                                                                                                                                              
     236               0 :         if ($settings['profile_fixed_user_fields']) $this->configData['fixedUserFields'] = $settings['profile_fixed_user_fields'];                                                                                                                                                                                                                                                                                                                                               
     237               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     238                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     239                 :      * Legt zentrale CSS-Style-Informationen in einem Array ab.                                                                                                                                                                                                                                                                                                                                                                                                                  
     240                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     241                 :      * Diese Styles werden in den Formularen verwendet.                                                                                                                                                                                                                                                                                                                                                                                                                          
     242                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     243                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     244                 :      * @return void                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     245                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     246                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     247                 :     public function setStyleData() {                                                                                                                                                                                                                                                                                                                                                                                                                                             
     248               0 :         $this->styles['tableHead'] = "tableSubHeaderDark";                                                                                                                                                                                                                                                                                                                                                                                                                       
     249               0 :         $this->styles['tableRow'] = "tableCell";                                                                                                                                                                                                                                                                                                                                                                                                                                 
     250               0 :         $this->styles['errorRow'] = "tableCellError";                                                                                                                                                                                                                                                                                                                                                                                                                            
     251               0 :         $this->styles['infoText'] = "tableCellSmall";                                                                                                                                                                                                                                                                                                                                                                                                                            
     252               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     253                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     254                 :      * Zentrale Hilfetext-ID Zuordnung                                                                                                                                                                                                                                                                                                                                                                                                                                           
     255                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     256                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     257                 :      * @return void                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     258                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     259                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     260                 :     public function setHelpData() {                                                                                                                                                                                                                                                                                                                                                                                                                                              
     261               0 :         $this->help['vorname'] = 301;                                                                                                                                                                                                                                                                                                                                                                                                                                            
     262               0 :         $this->help['nachname'] = 302;                                                                                                                                                                                                                                                                                                                                                                                                                                           
     263               0 :         $this->help['email'] = 303;                                                                                                                                                                                                                                                                                                                                                                                                                                              
     264               0 :         $this->help['loginname'] = 304;                                                                                                                                                                                                                                                                                                                                                                                                                                          
     265               0 :         $this->help['password'] = 305;                                                                                                                                                                                                                                                                                                                                                                                                                                           
     266               0 :         $this->help['password1'] = 305;                                                                                                                                                                                                                                                                                                                                                                                                                                          
     267               0 :         $this->help['password2'] = 306;                                                                                                                                                                                                                                                                                                                                                                                                                                          
     268               0 :         $this->help['password3'] = 307;                                                                                                                                                                                                                                                                                                                                                                                                                                          
     269               0 :         $this->help['street'] = 308;                                                                                                                                                                                                                                                                                                                                                                                                                                             
     270               0 :         $this->help['postcode'] = 309;                                                                                                                                                                                                                                                                                                                                                                                                                                           
     271               0 :         $this->help['location'] = 310;                                                                                                                                                                                                                                                                                                                                                                                                                                           
     272               0 :         $this->help['picShowFlag'] = 319;                                                                                                                                                                                                                                                                                                                                                                                                                                        
     273               0 :         $this->help['shortname'] = 325;                                                                                                                                                                                                                                                                                                                                                                                                                                          
     274               0 :         $this->help['usergroup'] = 326;                                                                                                                                                                                                                                                                                                                                                                                                                                          
     275               0 :         $this->help['invisible'] = 328;                                                                                                                                                                                                                                                                                                                                                                                                                                          
     276               0 :         $this->help['styleOverwriteMode'] = 350;                                                                                                                                                                                                                                                                                                                                                                                                                                 
     277               0 :         $this->help['picTitle'] = "";                                                                                                                                                                                                                                                                                                                                                                                                                                            
     278               0 :         $this->help['university'] = "";                                                                                                                                                                                                                                                                                                                                                                                                                                          
     279               0 :         $this->help['department'] = "";                                                                                                                                                                                                                                                                                                                                                                                                                                          
     280               0 :         $this->help['subject'] = "";                                                                                                                                                                                                                                                                                                                                                                                                                                             
     281               0 :         $this->help['countryID'] = "";                                                                                                                                                                                                                                                                                                                                                                                                                                           
     282               0 :         $this->help['gender'] = "";                                                                                                                                                                                                                                                                                                                                                                                                                                              
     283               0 :         $this->help['salutation'] = "";                                                                                                                                                                                                                                                                                                                                                                                                                                          
     284               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     285                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     286                 :     * Gibt die User ID zurueck                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     287                 :     * @return: Int                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     288                 :     * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     289                 :     */                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     290                 :     public function getUserID(){                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     291               0 :        return $this->userID;                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     292                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     293                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     294                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     295                 :     * Gibt an, ob user in der db vorhanden ist                                                                                                                                                                                                                                                                                                                                                                                                                                   
     296                 :     * @return: Bool                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     297                 :     * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     298                 :     */                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     299                 :     public function userExists(){                                                                                                                                                                                                                                                                                                                                                                                                                                                
     300               0 :        return $this->exists;                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     301                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     302                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     303                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     304                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     305                 :     * Gibt einen Skriptlink zurueck                                                                                                                                                                                                                                                                                                                                                                                                                                              
     306                 :     * @return: String                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     307                 :     * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     308                 :     */                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     309                 :     public function getActionScript(){                                                                                                                                                                                                                                                                                                                                                                                                                                           
     310               0 :         return $this->actionScript;                                                                                                                                                                                                                                                                                                                                                                                                                                              
     311                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     312                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     313                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     314                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     315                 :     * Gibt das User Upload Verzeichnis zurueck                                                                                                                                                                                                                                                                                                                                                                                                                                   
     316                 :     * @return: String                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     317                 :     * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     318                 :     */                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     319                 :     public function getUploadDir(){                                                                                                                                                                                                                                                                                                                                                                                                                                              
     320               0 :        return $this->uploadDir;                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     321                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     322                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     323                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     324                 :      * Gibt, wenn vorhanden, eine Eigenschaft des Users zurueck. Diese Eigenschaft wird im field Parameter mitgegeben und ist eine einfache String Variable.                                                                                                                                                                                                                                                                                                                     
     325                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     326                 :      * Hier wird ein Array als Datenstruktur in diese Klasse gekapselt.  Es koennte jedoch auch eine andere Datenstruktur sein.                                                                                                                                                                                                                                                                                                                                                  
     327                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     328                 :      * @param String $field                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     329                 :      * @return String                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     330                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     331                 :     public function getUserData($field){                                                                                                                                                                                                                                                                                                                                                                                                                                         
     332               0 :        if(isset($this->userData[$field]))                                                                                                                                                                                                                                                                                                                                                                                                                                        
     333               0 :           return $this->userData[$field];                                                                                                                                                                                                                                                                                                                                                                                                                                        
     334               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     335                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     336                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     337                 :      * sets the data in the given field in the userData array                                                                                                                                                                                                                                                                                                                                                                                                                    
     338                 :      * @pre value is not null after validation                                                                                                                                                                                                                                                                                                                                                                                                                                   
     339                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     340                 :      *@return void                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     341                 :      * @param String $field                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     342                 :      * @param String $value                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     343                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     344                 :     public function setUserData($field, $value){                                                                                                                                                                                                                                                                                                                                                                                                                                 
     345               0 :         $value = Data::toMysql($value, false);                                                                                                                                                                                                                                                                                                                                                                                                                                   
     346               0 :         if(sizeof($value)>0) $this->userData[$field] =$value;                                                                                                                                                                                                                                                                                                                                                                                                                    
     347               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     348                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     349                 :      * @return array                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     350                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     351                 :     public function getConfigData($field) {                                                                                                                                                                                                                                                                                                                                                                                                                                      
     352               0 :         if(isset($this->configData[$field]))                                                                                                                                                                                                                                                                                                                                                                                                                                     
     353               0 :         return $this->configData[$field];                                                                                                                                                                                                                                                                                                                                                                                                                                        
     354               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     355                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     356                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     357                 :      * @return string                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     358                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     359                 :     public function getHelp($field) {                                                                                                                                                                                                                                                                                                                                                                                                                                            
     360               0 :         if(isset($this->help[$field]))                                                                                                                                                                                                                                                                                                                                                                                                                                           
     361               0 :         return $this->help[$field];                                                                                                                                                                                                                                                                                                                                                                                                                                              
     362               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     363                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     364                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     365                 :      * @return string                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     366                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     367                 :     public function getStyles($field) {                                                                                                                                                                                                                                                                                                                                                                                                                                          
     368               0 :         if(isset($this->styles[$field]))                                                                                                                                                                                                                                                                                                                                                                                                                                         
     369               0 :         return $this->styles[$field];                                                                                                                                                                                                                                                                                                                                                                                                                                            
     370               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     371                 : /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     372                 :      * @param string $styles                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     373                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     374                 :     public function setStyles ($field, $value) {                                                                                                                                                                                                                                                                                                                                                                                                                                 
     375               0 :         $value=Data::toHTML($value, FALSE);                                                                                                                                                                                                                                                                                                                                                                                                                                      
     376               0 :         if(sizeof($value)>0) $this->styles[$field]= $value;                                                                                                                                                                                                                                                                                                                                                                                                                      
     377                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     378               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     379                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     380                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     381                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     382                 : }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

Generated by PHPUnit 3.2.21 and Xdebug 2.0.3 at Thu Nov 26 17:01:15 CET 2009.